#!/usr/bin/env bash

yum -y install gcc automake autoconf libtool make tcl

set -e
mkdir -p /opt/tmp

wget http://download.redis.io/releases/redis-4.0.8.tar.gz
tar xzf redis-4.0.8.tar.gz
mv redis-4.0.8.tar.gz /opt/tmp
mv redis-4.0.8 /opt/redis
cd /opt/redis
make


perl -p -i -e "s/bind 127.0.0.1/#bind 127.0.0.1/g" /opt/redis/redis.conf
perl -p -i -e "s/protected-mode yes/protected-mode no/g" /opt/redis/redis.conf
perl -p -i -e "s/daemonize no/daemonize yes/g" /opt/redis/redis.conf
echo -e "requirepass pass">> /opt/redis/redis.conf

#
# ./redis-server ../redis.conf